using GooglePlayGames;
using UnityEngine;

public class restartback : MonoBehaviour
{
	public AudioClip clip;

	public GUISkin skin;

	private float originalWidth = 640f;

	private float originalHeight = 360f;

	private Vector2 scale;

	public string leaderBoard = "6400 :8]";

	private void Start()
	{
		if (Screen.width > 640)
		{
			scale.x = (float)Screen.width / originalWidth;
			scale.y = (float)Screen.height / originalHeight;
		}
		else
		{
			scale.x = 1f;
			scale.y = 1f;
		}
		if (Screen.width > 1020)
		{
			scale.x = 1024f / originalWidth;
			scale.y = 600f / originalHeight;
		}
	}

	private void OnGUI()
	{
		GUI.skin = skin;
		if (GUI.Button(new Rect((float)(Screen.width / 2) - 98f * scale.x, (float)(Screen.height / 2) - 25f * scale.y, 95f * scale.x, 28f * scale.y), "Menu"))
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			Time.timeScale = 1f;
			Time.fixedDeltaTime = 0.033f;
			UnityEngine.SceneManagement.SceneManager.LoadScene("stadiumselectload");
		}
		if (GUI.Button(new Rect((float)(Screen.width / 2) + 2f * scale.x, (float)(Screen.height / 2) - 25f * scale.y, 95f * scale.x, 28f * scale.y), "Play Again"))
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			Time.timeScale = 1f;
			Time.fixedDeltaTime = 0.033f;
			UnityEngine.SceneManagement.SceneManager.LoadScene(UnityEngine.SceneManagement.SceneManager.GetActiveScene().buildIndex);
		}
		if (GUI.Button(new Rect((float)(Screen.width / 2) - 98f * scale.x, (float)(Screen.height / 2) + 15f * scale.y, 95f * scale.x, 28f * scale.y), "LeaderBoard"))
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			PlayGamesPlatform.Instance.ShowLeaderboardUI(leaderBoard);
		}
		if (GUI.Button(new Rect((float)(Screen.width / 2) + 2f * scale.x, (float)(Screen.height / 2) + 15f * scale.y, 95f * scale.x, 28f * scale.y), "Workshop"))
		{
			AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
			Time.timeScale = 1f;
			Time.fixedDeltaTime = 0.033f;
			UnityEngine.SceneManagement.SceneManager.LoadScene("workshop");
		}
	}
}
